package cn.lili.modules.promotion.serviceimpl;

import cn.lili.common.utils.StringUtils;
import cn.lili.modules.promotion.entity.dos.LiBlindboxRuleGoods;
import cn.lili.modules.promotion.mapper.LiBlindboxRuleGoodsMapper;
import cn.lili.modules.promotion.service.LiBlindboxRuleGoodsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@RequiredArgsConstructor
public class LiBlindboxRuleGoodsServiceImpl extends ServiceImpl<LiBlindboxRuleGoodsMapper, LiBlindboxRuleGoods> implements LiBlindboxRuleGoodsService {

    @Override
    public List<LiBlindboxRuleGoods> getLiBlindboxRuleGoodsByRuleId(String ruleId) {
        LambdaQueryWrapper<LiBlindboxRuleGoods> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotEmpty(ruleId),LiBlindboxRuleGoods::getRuleId,ruleId);
        queryWrapper.eq(LiBlindboxRuleGoods::getDeleteFlag, false);
        return baseMapper.selectList(queryWrapper);
    }
}
